//
//  mainTabBarViewController.swift
//  Swift微博
//
//  Created by 白鹭 on 2017/2/25.
//  Copyright © 2017年 com.bailun91. All rights reserved.
//

import UIKit

class mainTabBarViewController: UITabBarController {
    
    lazy var composeBtn = UIButton(imageName: "tabbar_compose_icon_add", BgImageName: "tabbar_compose_button")
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
  
    override func viewWillAppear(_ animated: Bool) {
        super .viewWillAppear(animated)
        addComposeBtn()
        
    }

}

extension mainTabBarViewController{
    
    // MARK:- 添加加号按钮
    func addComposeBtn (){
       
        composeBtn.center = CGPoint(x:tabBar.center.x, y:tabBar.bounds.size.height * 0.5)
        composeBtn.addTarget(self, action:#selector(mainTabBarViewController.addBtnClick), for: .touchUpInside)
    tabBar.addSubview(composeBtn)
        
    }
    
    func addBtnClick() {
        
        let composeVC = ComposeVC()
        let nav = UINavigationController(rootViewController: composeVC)
        present(nav, animated: true, completion: nil)
        
    }
    
    

}




